package com.cby.android.sample.model

import android.app.Application
import com.cby.android.library.base.BasePageStateViewModel
import com.cby.android.sample.bean.roll.RollJokeBean
import com.cby.android.sample.repository.RollApiImpl

/**
 * @description: RollJokeViewModel
 * @author: ChenBaoYang
 * @createDate: 2022/5/5 5:42 下午
 */
class RollJokeViewModel(application: Application) : BasePageStateViewModel<RollJokeBean>(application) {

    private val api = RollApiImpl()

    override suspend fun loadPageData(page: Int): MutableList<RollJokeBean> {
        val response = api.getJokeList(page)
        return if(response.data != null) {
            response.data!!.list
        } else{
            mutableListOf()
        }
    }
}